

<%@ page import="hc.uco.Paciente" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'paciente.label', default: 'Paciente')}" />
        <title><g:message code="default.edit.label" args="[entityName]" /></title>
        <g:javascript library="jquery" plugin="jquery"/>
        <g:javascript library="jquery.maskedinput-1.2.2" />
        <jqui:resources theme="ui-lightness" />
	    <script type="text/javascript">
	    	jQuery(function($){
	    	   $("#cpf").mask("999.999.999-99",{placeholder:" "});
	    	   $("#cep").mask("99999-999",{placeholder:" "});
	    	   $("#telefone1").mask("(99) 9999-9999",{placeholder:" "});
	    	   $("#telefone2").mask("(99) 9999-9999",{placeholder:" "});
	    	   $("#telefone3").mask("(99) 9999-9999",{placeholder:" "});
	    	   $("#telefone4").mask("(99) 9999-9999",{placeholder:" "});
	    	   $("#telefone5").mask("(99) 9999-9999",{placeholder:" "});
	    	});
	    </script>
	    <g:set var="startYear" value="${(1800 + (new Date().year))}" />
        <g:set var="endYear" value="${(1900 + (new Date().year))}" />
        <g:set var="dateFormat" value="%d/%m/%Y" />
        <g:set var="dateTimeFormat" value="%d/%m/%Y %H:%M" />
        <g:set var="defaultDate" value="${new GregorianCalendar(1900 + (new Date().year),0,1,12,30,0)}" />
    </head>
    <body>
        <g:render template="/mainbar" />
        <div class="body">
            <h1><g:message code="default.edit.label" args="[entityName]" /></h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${pacienteInstance}">
            <div class="errors">
                <g:renderErrors bean="${pacienteInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:form method="post" >
                <g:hiddenField name="id" value="${pacienteInstance?.id}" />
                <g:hiddenField name="version" value="${pacienteInstance?.version}" />
                <div class="dialog">
                    <table>
                        <tbody>
                        	<tr class="prop">
                                <td valign="middle" class="name">
                                	<label for="hospitalizado"><g:message code="paciente.hospitalizado.label" default="Hospitalizado" /></label>
                                </td>
                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'hospitalizado', 'errors')}" colspan="1">
                                    <g:checkBox name="hospitalizado" value="${pacienteInstance?.hospitalizado}" />
                            	</td>
                            	<td valign="middle" class="name">
                                	<label for="inclusaoEstudo"><g:message code="paciente.inclusaoEstudo.label" default="Inclusão no Estudo" /></label>
                                </td>
                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'inclusaoEstudo', 'errors')}" colspan="1">
                                    <g:checkBox name="inclusaoEstudo" value="${pacienteInstance?.inclusaoEstudo}" />
                            	</td>
                            </tr>
                            <tr class="prop">
                                <td valign="middle" class="name">
                                    <label for="nome"><g:message code="paciente.nome.label" default="Nome" /></label>
                                </td>
                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'nome', 'errors')}" colspan="1">
                                    <g:textField name="nome" maxlength="200" value="${pacienteInstance?.nome}" size="50"/>
                                </td>
                                
                                <td valign="middle" class="name">
                                    <label for="numero"><g:message code="paciente.numeroEstudo.label" default="Numero" /></label>
                                </td>
                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'numeroEstudo', 'errors')}">
                                    <g:textField name="numeroEstudo" maxlength="15" value="${pacienteInstance?.numeroEstudo}" />
                                </td>
                                <td valign="middle" class="name">
                                    <label for="dataInclusao"><g:message code="paciente.dataInclusao.label" default="Data Inclusao" /></label>
                                </td>
                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'dataInclusao', 'errors')}" nowrap="nowrap">
                                    <calendar:datePicker name="dataInclusao" value="${pacienteInstance?.dataInclusao}" defaultValue="${defaultDate}" dateFormat="${dateFormat}" weekNumbers="false" years="${startYear},${endYear}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                
                                <td valign="middle" class="name">
                                    <label for="genero"><g:message code="paciente.genero.label" default="Genero" /></label>
                                </td>
                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'genero', 'errors')}">
                                    <g:select name="genero" from="${pacienteInstance.constraints.genero.inList}" value="${pacienteInstance?.genero}" valueMessagePrefix="paciente.genero"  />
                                </td>
                                <td valign="middle" class="name">
                                    <label for="nome"><g:message code="paciente.hc.label" default="HC" /></label>
                                </td>
                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'hc', 'errors')}" colspan="1">
                                    <g:textField name="hc" maxlength="20" value="${pacienteInstance?.hc}" size="20"/>
                                </td>
                                <td valign="middle" class="name">
                                    <label for="dataNascimento"><g:message code="paciente.dataNascimento.label" default="Data Nascimento" /></label>
                                </td>
                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'dataNascimento', 'errors')}" nowrap="nowrap">
                                    <calendar:datePicker name="dataNascimento" value="${pacienteInstance?.dataNascimento}" defaultValue="${defaultDate}" dateFormat="${dateFormat}" weekNumbers="false" years="${startYear},${endYear}" />
                                </td>
                            </tr>
                            
                            <tr class="prop">
                                <td valign="middle" class="name">
                                    <label for="cpf"><g:message code="paciente.cpf.label" default="Cpf" /></label>
                                </td>
                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'cpf', 'errors')} ">
                                    <g:textField name="cpf" value="${pacienteInstance?.cpf}" />
                                </td>
                                <td valign="middle" class="name">
                                    <label for="nomeMae"><g:message code="paciente.nomeMae.label" default="Nome Mae" /></label>
                                </td>
                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'nomeMae', 'errors')}" colspan="3">
                                    <g:textField name="nomeMae" value="${pacienteInstance?.nomeMae}" size="70" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="middle" class="name">
                                    <label for="primeiroHospital"><g:message code="paciente.primeiroHospital.label" default="Primeiro Hospital" /></label>
                                </td>
                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'primeiroHospital', 'errors')}" colspan="1">
                                    <g:textField name="primeiroHospital" maxlength="200" value="${pacienteInstance?.primeiroHospital}" size="40"/>
                                </td>
                                <td valign="middle" class="name">
                                    <label for="transferenciaPara"><g:message code="paciente.transferenciaPara.label" default="Transferencia Para HC-Unicamp" /></label>
                                </td>
                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'transferenciaPara', 'errors')}" nowrap="nowrap">
                                	<calendar:datePicker name="transferenciaPara" value="${pacienteInstance?.transferenciaPara}" defaultValue="${defaultDate}" dateFormat="${dateFormat}" weekNumbers="false" years="${startYear},${endYear}" />
                                </td>
                                <td valign="middle" class="name">
                                    <label for="hospitalInternacao"><g:message code="paciente.hospitalInternacao.label"  default="Hospital Internado" /></label>
                                </td>
                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'hospitalInternacao', 'errors')}">
                                    <g:select name="hospitalInternacao" from="${pacienteInstance.constraints.hospitalInternacao.inList}" value="${pacienteInstance?.hospitalInternacao}" valueMessagePrefix="paciente.hospitalInternacao" />
                                </td>
                            </tr>
                        
                        
                            <tr class="prop">
                                <td valign="middle" class="name">
                                    <label for="profissao"><g:message code="paciente.profissao.label" default="Profissao" /></label>
                                </td>
                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'profissao', 'errors')}">
                                    <g:textField name="profissao" maxlength="50" value="${pacienteInstance?.profissao}" size="50" />
                                </td>
                                <td valign="middle" class="name">
                                    <label for="escolaridadeAnos"><g:message code="paciente.escolaridadeAnos.label" default="Escolaridade" /></label>
                                </td>
                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'escolaridadeAnos', 'errors')}">
                                    <g:textField name="escolaridadeAnos" value="${pacienteInstance?.escolaridadeAnos}" size="3"/> anos
                                </td>
                                <td valign="middle" class="name">
                                    <label for="rendaFamiliar"><g:message code="paciente.rendaFamiliar.label" default="Renda Familiar" /></label>
                                </td>
                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'rendaFamiliar', 'errors')}">
                                    R$ <g:textField name="rendaFamiliar" value="${pacienteInstance?.rendaFamiliar}" size="6" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="middle" class="name">
                                    <label for="endereco"><g:message code="paciente.endereco.label" default="Endereco" /></label>
                                </td>
                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'endereco', 'errors')}" colspan="3">
                                    <g:textField name="endereco" value="${pacienteInstance?.endereco}" size="80"/>
                                </td>
                                
                                <td valign="middle" class="name">
                                    <label for="bairro"><g:message code="paciente.bairro.label" default="Bairro" /></label>
                                </td>
                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'bairro', 'errors')}" colspan="1">
                                    <g:textField name="bairro" maxlength="50" value="${pacienteInstance?.bairro}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                            	<td valign="middle" class="name">
                                    <label for="cidade"><g:message code="paciente.cidade.label" default="Cidade" /></label>
                                </td>
                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'cidade', 'errors')}">
                                    <g:textField name="cidade" value="${pacienteInstance?.cidade}" />
                                </td>
                                <td valign="middle" class="name">
                                    <label for="cidade"><g:message code="paciente.estado.label" default="Estado" /></label>
                                </td>
                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'estado', 'errors')}">
                                	<g:select name="estado" from="${pacienteInstance.constraints.estado.inList}" value="${pacienteInstance?.estado}" valueMessagePrefix="paciente.estado"  />
                                </td>
                                <td valign="middle" class="name">
                                    <label for="cep"><g:message code="paciente.cep.label" default="Cep" /></label>
                                </td>
                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'cep', 'errors')} " colspan="1">
                                    <g:textField name="cep" maxlength="9" value="${pacienteInstance?.cep}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="middle" class="name">
                                    <label for="telefone1"><g:message code="paciente.telefones.label" default="Telefone1" /></label>
                                </td>
                                <td valign="middle" class="value" colspan="5">
                                	<table class="transp" cellspacing="0" cellpadding="0">
                                	<tr>
	                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'telefone1', 'errors')} ">
	                                    1. <g:textField name="telefone1" value="${pacienteInstance?.telefone1}" />
	                                </td>
	                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'telefone2', 'errors')} ">
	                                    2. <g:textField name="telefone2" value="${pacienteInstance?.telefone2}" />
	                                </td>
	                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'telefone3', 'errors')} ">
	                                    3. <g:textField name="telefone3" value="${pacienteInstance?.telefone3}" />
	                                </td>
	                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'telefone4', 'errors')} ">
	                                    4. <g:textField name="telefone4" value="${pacienteInstance?.telefone4}" />
	                                </td>
	                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'telefone5', 'errors')} ">
	                                    5. <g:textField name="telefone5" value="${pacienteInstance?.telefone5}" />
	                                </td>
	                                </tr>
	                                </table>
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="observacoes"><g:message code="paciente.observacoes.label" default="Observacoes" /></label>
                                </td>
                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'observacoes', 'errors')}" colspan="5">
                                    <g:textArea name="observacoes" cols="100" rows="3" value="${pacienteInstance?.observacoes}" />
                                </td>
                            </tr>
                            
                            <tr class="prop">
                                <td valign="middle" class="name">
                                	<label for="usoAAS"><g:message code="paciente.usoAAS.label" default="Uso regular de antiagregante plaquetário nos últimos 7 dias" /></label>
                                </td>
                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'usoAAS', 'errors')}" colspan="1">
                                    <g:checkBox name="usoAAS" value="${pacienteInstance?.usoAAS}" />
                            	</td>
                            </tr>
                            
                             <tr class="prop">
                                <td valign="middle" class="name">
                                    <label for="diagnosticoAdmissao"><g:message code="paciente.diagnosticoAdmissao.label" default="Diagnóstico de Admissão" /></label>
                                </td>
                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'diagnosticoAdmissao', 'errors')}">
                                    <g:select name="diagnosticoAdmissao" from="${pacienteInstance.constraints.diagnosticoAdmissao.inList}" value="${pacienteInstance?.diagnosticoAdmissao}" valueMessagePrefix="paciente.diagnosticoAdmissao"  />
                                </td>
                            </tr>
                      </tbody>
                </table>
                <br>
                <br>
                <h2><g:message code="paciente.apresentacao.titulo" /></h2>
                <table>
                	<tbody>
                            <tr class="prop">
                            	<td valign="middle" class="name">
                                    <label for="inicioDor"><g:message code="paciente.inicioDor.label" default="Inicio Dor" /></label>
                                </td>
                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'inicioDor', 'errors')}" nowrap="nowrap">
                                    <calendar:datePicker name="inicioDor" value="${pacienteInstance?.inicioDor}" defaultValue="${defaultDate}" showTime="true" dateFormat="${dateTimeFormat}" weekNumbers="false" years="${startYear},${endYear}" />
                                </td>
                                <td valign="middle" class="name">
                                    <label for="chegadaPrimeiroHospital"><g:message code="paciente.chegadaPrimeiroHospital.label" default="Chegada Primeiro Hospital" /></label>
                                </td>
                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'chegadaPrimeiroHospital', 'errors')}" nowrap="nowrap">
                                    <calendar:datePicker name="chegadaPrimeiroHospital" value="${pacienteInstance?.chegadaPrimeiroHospital}" defaultValue="${defaultDate}" showTime="true" dateFormat="${dateTimeFormat}" weekNumbers="false" years="${startYear},${endYear}" />
                                </td>
                                <td valign="middle" class="name">
                                    <label for="ecgDiagnostico"><g:message code="paciente.ecgDiagnostico.label" default="Ecg Diagnostico" /></label>
                                </td>
                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'ecgDiagnostico', 'errors')}" nowrap="nowrap">
                                    <calendar:datePicker name="ecgDiagnostico" value="${pacienteInstance?.ecgDiagnostico}" defaultValue="${defaultDate}" showTime="true" dateFormat="${dateTimeFormat}" weekNumbers="false" years="${startYear},${endYear}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="middle" class="name">
                                    <g:message code="paciente.localIAM.label" default="Local IAM" />
                                </td>
                                <td valign="middle" class="value" colspan="5">
                                	<table class="transp"  cellspacing="0" cellpadding="0" width="80%">
                                	<tr>
	                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'iamAnterior', 'errors')}">
	                                    <g:checkBox name="iamAnterior" value="${pacienteInstance?.iamAnterior}" /> <label for="iamAnterior"><g:message code="paciente.iamAnterior.label" default="iamAnterior" /></label>
	                                </td>
	                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'doencaIamSsst', 'errors')}">
	                                    <g:checkBox name="iamInferior" value="${pacienteInstance?.iamInferior}" /> <label for="iamInferior"><g:message code="paciente.iamInferior.label" default="iamInferior" /></label>
	                                </td>
	                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'iamDorsal', 'errors')}">
	                                    <g:checkBox name="iamDorsal" value="${pacienteInstance?.iamDorsal}" /> <label for="iamDorsal"><g:message code="paciente.iamDorsal.label" default="iamDorsal" /></label>
	                                </td>
	                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'iamLateral', 'errors')}">
	                                    <g:checkBox name="iamLateral" value="${pacienteInstance?.iamLateral}" /> <label for="iamLateral"><g:message code="paciente.iamLateral.label" default="iamLateral" /></label>
	                                </td>
	                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'iamVentriculoDireito', 'errors')}">
	                                    <g:checkBox name="iamVentriculoDireito" value="${pacienteInstance?.iamVentriculoDireito}" /> <label for="iamVentriculoDireito"><g:message code="paciente.iamVentriculoDireito.label" default="iamVentriculoDireito" /></label>
	                                </td>
	                                </tr>
	                                </table>
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="middle" class="value" colspan="6">
                                	<table class="transp" cellspacing="0" cellpadding="0" width="100%">
                                	<tr>
	                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'paS', 'errors')} ${hasErrors(bean: pacienteInstance, field: 'paD', 'errors')}">
	                                    <label for="pa"><g:message code="paciente.pa.label" default="Pa" /></label> <g:textField name="paS" value="${pacienteInstance?.paS}" size="4" maxlength="3" /> / <g:textField name="paD" value="${pacienteInstance?.paD}" size="4" maxlength="3" />
	                                </td>
	                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'fc', 'errors')}">
	                                    <label for="fc"><g:message code="paciente.fc.label" default="Fc" /></label> <g:textField name="fc" value="${pacienteInstance?.fc}" size="4" maxlength="3"/>
	                                </td>
	                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'peso', 'errors')}">
	                                    <label for="peso"><g:message code="paciente.peso.label" default="peso" /></label> <g:textField name="peso" value="${pacienteInstance?.peso}" size="4" maxlength="3"/>
	                                </td>
	                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'altura', 'errors')}">
	                                    <label for="altura"><g:message code="paciente.altura.label" default="altura" /></label> <g:textField name="altura" value="${pacienteInstance?.altura}" size="4" maxlength="3"/>
	                                </td>
	                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'circAbd', 'errors')}">
	                                    <label for="circAbd"><g:message code="paciente.circAbd.label" default="circAbd" /></label> <g:textField name="circAbd" value="${pacienteInstance?.circAbd}" size="4" maxlength="3"/>
	                                </td>
	                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'killip', 'errors')}">
	                                    <label for="killip"><g:message code="paciente.killip.label" default="Killip" /></label> <g:select name="killip" from="${pacienteInstance.constraints.killip.inList}" value="${pacienteInstance?.killip}" valueMessagePrefix="paciente.killip"  />
	                                </td>
	                                </tr>
	                                </table>
                                </td>
                            </tr>
                            
                            <tr class="prop">
                                <td valign="middle" class="name">
                                    <label for="angina24horas"><g:message code="paciente.angina24horas.label" default="Angina nas 24 horas que antecedeu o evento" /></label>
                                </td>
                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'angina24horas', 'errors')}">
                                    <g:checkBox name="angina24horas" value="${pacienteInstance?.angina24horas}" />
                                </td>
                                <td valign="middle" class="name">
                                    <label for="episodiosAngina24horas"><g:message code="paciente.episodiosAngina24horas.label" default="Quantos Episódios" /></label>
                                </td>
                                <td valign="middle" class="value ${hasErrors(bean: pacienteInstance, field: 'episodiosAngina24horas', 'errors')}">
                                    <g:textField name="episodiosAngina24horas" value="${pacienteInstance?.episodiosAngina24horas}" size="2" />
                                </td>
                            </tr>
                        
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:actionSubmit class="save" action="update" value="${message(code: 'default.button.update.label', default: 'Update')}" /></span>
                    <span class="button"><g:actionSubmit class="delete" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
